import 'package:get/get.dart';
import 'package:inmotion_pro/extension/future_error_handler.dart';
import 'package:inmotion_pro/http/api_helper.dart';
import 'package:inmotion_pro/http/api_helper_vehicle.dart';
import 'package:inmotion_pro/pages/models/auth_application_model.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';

class BindApplyFromMeController extends GetxController {
  // 申请列表
  RxList<AuthApplicationModel> applicationList = <AuthApplicationModel>[].obs;

  // 刷新控制器
  final RefreshController refreshController = RefreshController();

  @override
  void onInit() {
    super.onInit();
  }

  onRefresh() {
    return ApiHelper()
        .getSecondaryOwnerApplicationList(toMe: false)
        .then((list) {
      applicationList.clear();
      applicationList.addAll(list);
    }).catchErrorHandler(
      onError: (p0) {
        refreshController.refreshFailed();
      },
    ).whenComplete(() {
      refreshController.refreshCompleted();
      refreshController.resetNoData();
    });
  }

  onLoadMore() async {}
}
